<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <!-- 
    如何使用Vuex

    通过new Vuex.Store({
      配置
    })


    1 通过new Vuex.Store得到store对象 
      const store = new Vuex.Store({

      })

    2 将store添加到vue中
      const app = new Vue({
        store
      })

      这样操作，那么在vue的data中就会有$store


   -->
  <div id="app">


  </div>
  <script src="./vue.js"></script>
  <script src="./vuex.js"></script>
  <script>

    const store = new Vuex.Store({
      state: {
        a: 1
      }
    })

    const app = new Vue({
      el: "#app",
      store // 一旦我们把store添加到new Vue中，那么在this上就会产生this.$store
    })
  
  </script>
</body>
</html>